package com.yxuan.springboot.controller;

import com.yxuan.springboot.service.AgentsService;
import com.yxuan.springboot.util.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.yxuan.springboot.model.Agents;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 * @author zchao
 *   Agents控制器
 * @date 2024-05-24 16:31:04
 */
@Controller
@Api(tags = "代理表")
@RequestMapping(value = "/agents", method = {RequestMethod.POST,RequestMethod.GET})
public class AgentsController extends BaseController<Agents>{

    @Autowired
    private AgentsService agentsService;

    /*
    * 注册登录
    * */
    @ResponseBody
    @RequestMapping("/agentLogin")
    public Result agentLogin(String aphonenumber,String apassword) throws Exception {
        return agentsService.agentLogin(aphonenumber,apassword);
    }

    /*
    * 查看业绩
    * */
    @ResponseBody
    @RequestMapping("/getKPI")
    public Result getKPI(String agentId) throws Exception {
        return agentsService.getKPI(agentId);
    }

    /*
     * 查看今天与昨天业绩
     * */
    @ResponseBody
    @RequestMapping("/getTDANDYDKPI")
    public Result getTDANDYDKPI(String agentId) throws Exception {
        return agentsService.getTDANDYDKPI(agentId);
    }
}
